var MenuViewModel = function(){
	var self = this;
	
	self.displayLogin = function(){
		$loginContainter = $( '.login-container' );
		
		if( $loginContainter.css( 'display' ) != 'none' ){
			$loginContainter.slideUp();
		}else{
			$loginContainter.slideDown();
		}
	}
	
	self.login = function(){
		$( '#error-login' ).hide();
		$.get( '/site/login', { username: $( '#login-username' ).val(), password: $( '#login-password' ).val() }, function( data ){
			if( data.error !== undefined ){
				$( '#error-login span' ).html( data.error );
				$( '#error-login' ).show();
            }else{
            	window.location = '/news';
            }
		} );
	}
}